github-markdown-adf 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/github-markdown-adf)](https://www.npmjs.com/package/github-markdown-adf)
4
4
  [![CI](https://github.com/joroden/github-markdown-adf/actions/workflows/ci.yml/badge.svg)](https://github.com/joroden/github-markdown-adf/actions)
5
+ [![Socket Badge](https://badge.socket.dev/npm/package/github-markdown-adf)](https://badge.socket.dev/npm/package/github-markdown-adf)
5
6
  [![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](https://unlicense.org)
6
7
 
7
8
  Bidirectional **GitHub Flavored Markdown (GFM) to / from Atlassian Document Format (ADF)** converter.
@@ -137,20 +138,39 @@ import { mdToAdf, adfToMd } from 'github-markdown-adf';
137
138
 
138
139
  ### `mdToAdf(markdown: string): AdfDoc`
139
140
 
140
- Converts a GFM string to an ADF document object. Parses using [remark](https://github.com/remarkjs/remark) / [unified](https://github.com/unifiedjs/unified) with full GFM extensions: tables, task lists, strikethrough, and GitHub Alert syntax (`> [!NOTE]`, `> [!WARNING]`, etc.).
141
+ Converts a GFM string to an ADF document object. Parses using mdast and micromark GFM extensions, with support for tables, task lists, strikethrough, and GitHub Alert syntax (`> [!NOTE]`, `> [!WARNING]`, etc.).
141
142
 
142
- ### `adfToMd(adf: AdfDoc): string`
143
+ ### `adfToMd(adf: AdfDoc, options?: AdfToMdOptions): string`
143
144
 
144
145
  Converts an ADF document object to a GFM string. Handles all standard ADF node and mark types and produces clean, readable output targeting GitHub Flavored Markdown.
145
146
 
147
+ ## Options
148
+
149
+ `adfToMd` accepts an optional second argument to control rendering behaviour.
150
+
151
+ ### `AdfToMdOptions`
152
+
153
+ | Option | Type | Default | Description |
154
+ |---|---|---|---|
155
+ | `mentions` | `boolean` | `true` | When `true`, renders mention nodes as the display text if available, otherwise as `@{id}`. When `false`, renders as plain text: display text if available, otherwise just the bare `{id}` without an `@` prefix. |
156
+
157
+ ### Usage example
158
+
159
+ ```typescript
160
+ // Render mentions as plain text instead of @-tagged references
161
+ const md = adfToMd(adfDoc, { mentions: false });
162
+ ```
163
+
146
164
  ## TypeScript Types
147
165
 
148
- All ADF types are exported for use in your own code:
166
+ All ADF types and option interfaces are exported for use in your own code:
149
167
 
150
168
  ```typescript
151
169
  import type { AdfDoc, AdfNode, AdfMark, AdfInlineNode, AdfTopLevelBlockNode } from 'github-markdown-adf';
152
170
  // Also available: ParagraphNode, HeadingNode, TableNode, PanelNode, CodeBlockNode,
153
171
  // BulletListNode, OrderedListNode, TaskListNode, TextNode, MentionNode, ...and more
172
+
173
+ import type { AdfToMdOptions } from 'github-markdown-adf';
154
174
  ```
155
175
 
156
176
  ## Requirements